package day03;

/**
 * @author zdl
 * @date 2024/11/6
 */
public class Demo6 {
    public static void main(String[] args) {
        int sum = 0;
        for (int i = 1; i < 100; i+=2) {
            sum = sum+i ;
        }
        System.out.println("1+3+5+...+99 的和为："+sum);

        int he = 0;
        int c = 1;
        while ( c < 100){
            he += c;
            c+=2;
        }
        System.out.println(he);

        //题目10: 输出乘法口诀表
        for (int i = 1; i < 10; i++) { //行
            for (int j = 1; j <= i; j++) {  //列
                System.out.print(j +"*"+i + "=" +i*j+"\t");
            }
            System.out.println();
        }

        /**
         *       A      3空 A
         *      ABA     2空 ABA
         *     ABCBA    1空 ABCBA
         *    ABCDCBA   ABCDBCA
         */

        for (int i = 0; i < 4; i++) { //行
            for (int j = 0; j < 3-i ; j++) { //空
                System.out.print(" ");
            }
            for (int j = 0; j <= i; j++) { //正序 ABCD
                System.out.print((char)('A'+j));
            }
            for (int j = 0; j < i ; j++) { //倒序 CBA
                System.out.print((char)('A'+2 - j));
            }
            System.out.println();
        }


    }


}
